Modelica.Utilities.System

Interaction with environment

Information

This package contains functions to interact with the environment.

Extends from Modelica.Icons.FunctionsPackage (Icon for packages containing functions).

Package Content

Name Description
Modelica.Utilities.System.getWorkDirectory getWorkDirectory Get full path name of work directory
Modelica.Utilities.System.setWorkDirectory setWorkDirectory Set work directory
Modelica.Utilities.System.getEnvironmentVariable getEnvironmentVariable Get content of environment variable
Modelica.Utilities.System.setEnvironmentVariable setEnvironmentVariable Set content of local environment variable
Modelica.Utilities.System.getTime getTime Retrieve the local time (in the local time zone)
Modelica.Utilities.System.getPid getPid Retrieve the current process id
Modelica.Utilities.System.command command Execute command in default shell
Modelica.Utilities.System.exit exit Terminate execution of Modelica environment

Modelica.Utilities.System.getWorkDirectory Modelica.Utilities.System.getWorkDirectory

Get full path name of work directory

Information

Extends from Modelica.Icons.Function (Icon for functions).

Outputs

NameDescription
directoryFull path name of work directory

Modelica.Utilities.System.setWorkDirectory Modelica.Utilities.System.setWorkDirectory

Set work directory

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

NameDescription
directoryNew work directory

Modelica.Utilities.System.getEnvironmentVariable Modelica.Utilities.System.getEnvironmentVariable

Get content of environment variable

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

NameDescription
nameName of environment variable
convertToSlashTrue, if native directory separators in environment variable shall be changed to '/'

Outputs

NameDescription
contentContent of environment variable (empty, if not existent)
exist= true, if environment variable exists; = false, if it does not exist

Modelica.Utilities.System.setEnvironmentVariable Modelica.Utilities.System.setEnvironmentVariable

Set content of local environment variable

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

NameDescription
nameName of environment variable
contentValue of the environment variable
convertFromSlashTrue, if '/' in environment variable shall be changed to native directory separators

Modelica.Utilities.System.getTime Modelica.Utilities.System.getTime

Retrieve the local time (in the local time zone)

Information

Syntax

(ms, sec, min, hour, day, mon, year) = System.getTime();

Description

Returns the local time at the time instant this function was called. All returned values are of type Integer and have the following meaning:

Argument Range Description
ms 0 .. 999 Milli-seconds after seconds
sec 0 .. 59 Seconds after minute
min 0 .. 59 Minutes after hour
hour 0 .. 23 Hours after midnight
day 1 .. 31 Day of month
mon 1 .. 12 Current month
year ≥ 2015 Current year

Example

(ms, sec, min, hour, mon, year) = getTime()   // = (281, 30, 13, 10, 15, 2, 2015)
                                              // Feb. 15, 2015 at 10:13 after 30.281 s

Note

This function is impure!

Extends from Modelica.Icons.Function (Icon for functions).

Outputs

NameDescription
msMillisecond
secSecond
minMinute
hourHour
dayDay
monMonth
yearYear

Modelica.Utilities.System.getPid Modelica.Utilities.System.getPid

Retrieve the current process id

Information

Syntax

pid = System.getPid();

Description

Returns the pid (process identification) of the process in which this function is called. This is an impure function and the returned value depends on the operating system.

Example

getPid()   // = 3044

Note

This function is impure!

Extends from Modelica.Icons.Function (Icon for functions).

Outputs

NameDescription
pidProcess ID

Modelica.Utilities.System.command Modelica.Utilities.System.command

Execute command in default shell

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

NameDescription
stringString to be passed to shell

Outputs

NameDescription
resultReturn value from command (depends on environment)

Modelica.Utilities.System.exit Modelica.Utilities.System.exit

Terminate execution of Modelica environment

Information

Extends from ModelicaServices.System.exit (Terminate execution of Modelica environment).

Inputs

NameDescription
statusResult to be returned by environment (0 means success)
Automatically generated Thu Oct 1 16:08:16 2020.